﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using deal_h2ck.DTO;
using deal_h2ck.Business;

namespace deal_h2ck.Presentation
{
    public partial class DangNhap : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnOK_Click(object sender, EventArgs e)
        {
            
            CKhachHangDTO dto = new CKhachHangDTO(txtEmail.Text,txtMatKhau.Text);
            
            if (KhachHangBUS.DangNhap(dto))
            {

                Response.Cookies["Email"].Value = dto.Email;
                string url = ViewState["ReUrl"] == null ? "~/Presentation/Default.aspx" : ViewState["RefUrl"].ToString();
                Response.Redirect(url);
            }
        }
    }
}